import time
from selenium import webdriver
from selenium.webdriver.common.by import By
browser = webdriver.Chrome()
browser.maximize_window()
browser.get('https://www.163.com/search')
time.sleep(1)
browser.find_element(By.CSS_SELECTOR, '#netease_search_input').send_keys('人工智能')
browser.find_element(By.CSS_SELECTOR, '#netease_search_btn').click()
last_height = browser.execute_script("return document.body.scrollHeight;")
while True:
    time.sleep(3)
    browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")
    new_height = browser.execute_script("return document.body.scrollHeight;")
    if new_height != last_height:
        last_height = new_height
    else:
        print('已经滚动到页面底部')
        break
